import {
  reqGetResumeDeliveryList,
  reqBatchAddResumeDelivery,
  reqEditResumeDelivery,
  reqBatchDelResumeDelivery,
} from '@/views/Custom/ResumeMng/api/ResumeDeliveryApi';
const actions = {
  // 获取简历投递列表
  async getResumeDeliveryList({ commit }, params) {
    let result = await reqGetResumeDeliveryList(params);
    commit('GETRESUMEDELIVERYLIST', result.data.resumeDeliveryIPage);
  },
  //简历投递信息新增
  async batchAddResumeDelivery({ commit }, params) {
    let result = await reqBatchAddResumeDelivery(params);
    return result;
  },
  //简历投递删除
  async delResumeDelivery({ commit }, params) {
    let result = await reqBatchDelResumeDelivery(params);
    return result;
  },
  //简历投递删除
  async editResumeDelivery({ commit }, params) {
    let result = await reqEditResumeDelivery(params);
    return result;
  },
};
const mutations = {
  GETRESUMEDELIVERYLIST(state, result) {
    state.resumeDeliveryIPage = result;
  },
};
const state = {
  resumeDeliveryIPage: {}, //简历投递分页查询后返回的对象
  resumeDeliveryList: {}, //简历投递分页查询后返回的对象
};
const getters = {
  resumeDeliveryIPage(state) {
    return state.resumeDeliveryIPage || [];
  },
  resumeDeliveryList(state) {
    return state.resumeDeliveryIPage
      ? state.resumeDeliveryIPage.records || []
      : [];
  },
};
export default {
  namespaced: true,
  actions,
  mutations,
  state,
  getters,
};
